UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rnku3pOn1FJE0sznIIqpK5GHq5Byru16lthYF04nrxM=' 
WHERE 
  key_id = 'a7ac4829f712a54a2c0e2ca3b185ace61afd1117a0a3a72b9c33d7d6e6f1f62d' 
  AND (
    token = 'Rnku3pOn1FJE0sznIIqpK5GHq5Byru16lthYF04nrxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020