UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Iimy3TQ00E+qbS+ARj+v6LcqJwShhnqH4mB5JfocD8='
WHERE
key_id = '9f8ec09d1e625af455b03215757e1eae3468167fb41adba79a159bcfc4822b33'
AND (
token = '4Iimy3TQ00E+qbS+ARj+v6LcqJwShhnqH4mB5JfocD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)