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