UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pUqp7LgndnIWkzXol3UB8Rgrbdgx31hu0eUwcvBUTcU='
WHERE
key_id = '400cf79340185b933378535e8f60cdc4c7b5d85f65e50a2ec5f045943bc24305'
AND (
token = 'pUqp7LgndnIWkzXol3UB8Rgrbdgx31hu0eUwcvBUTcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)