UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YUssbA41LM2efFOtjzoREhbtZ+CVw8/aPVwdu2WJT4w='
WHERE
key_id = '787881b2c22fd61d811cf2deefef62a4d79d706b6122d44bd12c099e72614aa0'
AND (
token = 'YUssbA41LM2efFOtjzoREhbtZ+CVw8/aPVwdu2WJT4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)