UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rky8pLKhlwDU1LUglT3xF6FdB5OgN11d+4Jap4ghr+8='
WHERE
key_id = 'fbe3f7b4c0bc8757843b3d7a5060c39626db8f03d793ea969604b5046b69050a'
AND (
token = 'Rky8pLKhlwDU1LUglT3xF6FdB5OgN11d+4Jap4ghr+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)