UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q3PF8fRyyUxStRoSYdUkMmmejurfvcGOcOtA44cVaNs='
WHERE
key_id = 'cb9e4a8d1bf0a5d9adc2a258b8bef2f63dac24b231847d4473d8a96538583e7d'
AND (
token = 'q3PF8fRyyUxStRoSYdUkMmmejurfvcGOcOtA44cVaNs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)