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