UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0bdTA0VVIQwX2ZdLH88W958vWumZJIp5oCmoa0F5AF4='
WHERE
key_id = '162ddb7894b8ac76d6572cddbf93005a193827cdae99a86f0899556c8fa10ea2'
AND (
token = '0bdTA0VVIQwX2ZdLH88W958vWumZJIp5oCmoa0F5AF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)