UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yjVyP/VvFNtDEnI7MTUFCef3w+6Sjm+EIjO/TI8ztI8='
WHERE
key_id = 'd455ae97ed7e3c8c18db7a70b829db858ca45d86028b016af288e715f51a9d45'
AND (
token = 'yjVyP/VvFNtDEnI7MTUFCef3w+6Sjm+EIjO/TI8ztI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)