UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/hZ8yK5a0UxLxFlSqbLALFAQQsBlimRnYeXRgn4cmlA='
WHERE
key_id = 'e5237b6ba7490e29940f6065168abfbf0f69605d2064d757340b715e6587ec40'
AND (
token = '/hZ8yK5a0UxLxFlSqbLALFAQQsBlimRnYeXRgn4cmlA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)