UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q80QBcClL1UMoGe5ErcbmJxbAkvxYbqRBHCBgzkauBY='
WHERE
key_id = 'd6974fb6dad9fafe053bff815d2ee556622e81306b514d86ee6d5a8f80a34676'
AND (
token = 'q80QBcClL1UMoGe5ErcbmJxbAkvxYbqRBHCBgzkauBY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)