UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+cJxM5ep44DMhj7pcMUaAF96pkGlpstUsZIYz954PLQ=' 
WHERE 
  key_id = '381945ea5c84cfa99a7b7ed0bbf0d26dcff69e477ecf9570b039fdda90b3af29' 
  AND (
    token = '+cJxM5ep44DMhj7pcMUaAF96pkGlpstUsZIYz954PLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037