UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iO9HE75oQN7wDNaVCXVbEgYE1KJ0ABeqzB7PN+EHunw=' 
WHERE 
  key_id = 'c8c5e4beb47b6d41b8df7c56fb32e219523fd33588ff49f0960bcd5db788621a' 
  AND (
    token = 'iO9HE75oQN7wDNaVCXVbEgYE1KJ0ABeqzB7PN+EHunw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029