UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRSAf21iPhgWpH4/nQpjQGG/mv9wIsqeZ2cJopITzY8='
WHERE
key_id = 'd536707f03a74676c15834ca73ef9bf50fbc083ebee1f2b737783a45697ac77b'
AND (
token = 'NRSAf21iPhgWpH4/nQpjQGG/mv9wIsqeZ2cJopITzY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)