UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w2WqUy4ymO+eH8H3GKlHtWOQGKu1KapmsuDU6AW3J5w='
WHERE
key_id = 'e9243da8705ab87fb7343c77becd53c90e410d1b147ce44bab223d2b5fc17ddb'
AND (
token = 'w2WqUy4ymO+eH8H3GKlHtWOQGKu1KapmsuDU6AW3J5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)