UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0sncyMl9Kd8XRirHRqnCMcMwZ4L5dFmg4FzE+hfNN0I=' 
WHERE 
  key_id = '5887e99c83ecbee064668bedf7ebea94612401530220d581f784b2071f7314a8' 
  AND (
    token = '0sncyMl9Kd8XRirHRqnCMcMwZ4L5dFmg4FzE+hfNN0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039