UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tInQVjwvh0RKD70L/zgFN679n3Jcz2Ht3rvqsf4BNI4='
WHERE
key_id = '59a1c75efa5875817324e772d9f30aefb7a175d7c9ceedae3289a12cd7314610'
AND (
token = 'tInQVjwvh0RKD70L/zgFN679n3Jcz2Ht3rvqsf4BNI4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)