UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PNkQh8Y06qexuZJ3xAdTCT8bmHR5rpwIwpLB5hNGAg='
WHERE
key_id = 'ca6d7643cd6090291273fea4a42335e51a4556826cb2e4d6a9edf44b1327aa33'
AND (
token = '6PNkQh8Y06qexuZJ3xAdTCT8bmHR5rpwIwpLB5hNGAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)