UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J64a7fxfYI4jEryldrWhjyhltIyJmhobM9LXtDJZucE='
WHERE
key_id = 'd6c1d488475e4fb875cd8627e8836f48b8b8ec58691f6a4993f6552a6e787245'
AND (
token = 'J64a7fxfYI4jEryldrWhjyhltIyJmhobM9LXtDJZucE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)