UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IjUWzUFxHGDRTabJgLK1bMePefOX2tvXCOCxOmh/Wuk=' 
WHERE 
  key_id = '9c9cf1e26e5cddb5d2267a01bcf2bb5c7000602452e5b869b5e98928bb75ee0f' 
  AND (
    token = 'IjUWzUFxHGDRTabJgLK1bMePefOX2tvXCOCxOmh/Wuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025