UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5o5IiECgLeTM9a+//eVgHNnWnIILJRu6hfpcIoLMctY='
WHERE
key_id = 'e509ea073bf2a7b54c82f33e80b38be247ed70484abbaaf034604b68535e0f96'
AND (
token = '5o5IiECgLeTM9a+//eVgHNnWnIILJRu6hfpcIoLMctY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)