UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RfcI+hjPUt84BZ3mDoUOlYzR7RY2r9eQCotJFcALa+8='
WHERE
key_id = '6a887bf8bcf570b16237d43882837e20c6ed3cd0ad56d09ab82667b893567777'
AND (
token = 'RfcI+hjPUt84BZ3mDoUOlYzR7RY2r9eQCotJFcALa+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)