UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fsS3Xhtsqol8Km/ciQFIePhmcrj30egy8NRnLUaPQvk='
WHERE
key_id = '538e72fc97b5a4dcce8640f1e17d5188396e1a7e973d40e4a03f513d4a06afc4'
AND (
token = 'fsS3Xhtsqol8Km/ciQFIePhmcrj30egy8NRnLUaPQvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)