UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nKk4qaJ7DD4RA3kQsEJmgGFS40/chXzvBh0nMBsZefw='
WHERE
key_id = '0a2d3621d4d584b1a59a357113f6dcea596ebd2b1657a371fcadc55012f196fd'
AND (
token = 'nKk4qaJ7DD4RA3kQsEJmgGFS40/chXzvBh0nMBsZefw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)