UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XXINSic5VTp/B6PybQqUhzPX5L0vt01wXkdBiYDEwl4=' 
WHERE 
  key_id = 'eb043f4eeb1baac3c309d65485d0decc745c787b166a6d0e057e697b77290a6d' 
  AND (
    token = 'XXINSic5VTp/B6PybQqUhzPX5L0vt01wXkdBiYDEwl4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036