UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E8uGTJyuYkYdeQaJjNLGgOyw5OF8COfTlQlR+9dLVV8='
WHERE
key_id = 'fa173a95b180069666fcee7d55a27aca15e0f417ff8e9b6c76f2f9c64a1da8d9'
AND (
token = 'E8uGTJyuYkYdeQaJjNLGgOyw5OF8COfTlQlR+9dLVV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)