UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Ssz7v/KrI+a5teE4vDgc1uh2GH/ubTS2+K+GxPt/fk=' 
WHERE 
  key_id = '2a8ccbd3b414439c3874b837c7e924d7a16dd05953d73940adcb2285fc350878' 
  AND (
    token = '+Ssz7v/KrI+a5teE4vDgc1uh2GH/ubTS2+K+GxPt/fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036