UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6tn3qQrn7i3bYSn9XQbUG0G6cYDoxkgJuW22HunSonQ='
WHERE
key_id = '612cf66b322d7ee32a0b304af1234feb0ce2376a8ee820920cd2831075519761'
AND (
token = '6tn3qQrn7i3bYSn9XQbUG0G6cYDoxkgJuW22HunSonQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)