UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd2KiFjKcJrCBRNImgXLxSI1iPrvyKrqtRKWEhFRKk0Q='
WHERE
key_id = '33125a0852bcafbd3243ab6b133a90c2306cdb714ebb1365a1969968a5ec2dec'
AND (
token = 'd2KiFjKcJrCBRNImgXLxSI1iPrvyKrqtRKWEhFRKk0Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)