UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fX3G/5KKDitTHFRlK1SdTfzRTKaL5CxAAtjpIVGwyjs='
WHERE
key_id = '384a4c27bdefbc222c381fe112705de6c4d4c5e4f1d1ba4c2d53654030029aaf'
AND (
token = 'fX3G/5KKDitTHFRlK1SdTfzRTKaL5CxAAtjpIVGwyjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)