UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'coKsa7FGXnHxLZX4OMedyYSqQGvkHVKQZ1XupbPf9hg='
WHERE
key_id = '539bd2523363a037d62194056c3b805c02b81d20df4f0ae84a84d6ccb14b76fb'
AND (
token = 'coKsa7FGXnHxLZX4OMedyYSqQGvkHVKQZ1XupbPf9hg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)