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

Query time 0.00031