UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MjMJZkmDkV1bfLi3nlzGQdO8z3WGlaPRlTwEtVdnkfw=' 
WHERE 
  key_id = '0172831af7db2efb7eb868a42b53449a9133bb4c1aedc1a29e0cd4a65b6fac26' 
  AND (
    token = 'MjMJZkmDkV1bfLi3nlzGQdO8z3WGlaPRlTwEtVdnkfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047