UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiTWKbGan7F+hbklTgT9LWZA6At45JSSL3q+lMzlshE=' 
WHERE 
  key_id = 'a94f164762707969a706c83941b8496adfd689834f7524d8db5ccfcbfbfa3b88' 
  AND (
    token = 'uiTWKbGan7F+hbklTgT9LWZA6At45JSSL3q+lMzlshE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032