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

Query time 0.00042